package com.app.car.video;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.text.TextUtils;


import com.app.car.R;
import com.app.car.basis.BasisActivity;


import butterknife.BindView;
import my.ActivityTool;
import my.LogUtil;
import tcking.github.com.giraffeplayer2.VideoView;

/**
 * 视频列表
 */
public class VideoIndexActivity extends BasisActivity {

    public  static void toDetail(Activity context, String url){
        Bundle extras = new Bundle();
        extras.putSerializable("url", url);
        ActivityTool.skipActivity(context, VideoIndexActivity.class,extras);
    }


    @BindView(R.id.video_view)
    public VideoView videoview;

    String url;


    @SuppressLint("SourceLockedOrientationActivity")
    @Override
    public void initViews() {
        setContentView(R.layout.video_list_item);
        setTitle("监控视频");
        setTitleLeftButton(null);

    }

    @Override
    public void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        url= getIntent().getStringExtra("url");
        if(TextUtils.isEmpty(url)){
            showToast("视频地址为空");
            finish();
            return;
        }

        videoview.setVideoPath(url);
        videoview.getPlayer().start();
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }


    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        LogUtil.i("onConfigurationChanged------->");
    }




}
